version: '3'

services:
  php:
    container_name: ${PROJECT}_php
    image: ${PROJECT}_php:${TAG}
    build:
      context: .
      dockerfile: docker/php/Dockerfile
    depends_on:
      - db
    volumes:
      - ./laravel:/site
    networks:
      - krnet

  server:
    container_name: ${PROJECT}_nginx
    image: ${PROJECT}_nginx:${TAG}
    build:
      context: .
      dockerfile: docker/nginx/Dockerfile
    ports:
      - 80:80
    depends_on:
      - php
    volumes:
      - './laravel:/site'
    networks:
      - krnet

  db:
    image: ${PROJECT}_psql
    build:
      context: .
      dockerfile: docker/psql/Dockerfile.postgresql
    restart: unless-stopped
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_DB: ${DB_DATABASE}
    volumes:
      - ./data/db:/var/lib/postgresql/data:rw
    container_name: ${PROJECT}_db
    hostname: db
    networks:
      - krnet

  adminer:
    image: adminer
    restart: unless-stopped
    ports:
      - "8888:8080"
    container_name: ${PROJECT}_adminer
    hostname: adminer
    networks:
      - krnet
      
#------------

networks:
  krnet:
    name: krnet
    driver: bridge
    external: true
      
